import 'package:flutter/material.dart';
import '../child_page.dart';

class MineCell extends StatelessWidget {
  const MineCell(
      {super.key,
      this.title,
      this.subtitle,
      this.imageName,
      this.subImageName});

  final String? title;
  final String? subtitle;
  final String? imageName;
  final String? subImageName;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        Navigator.of(context).push(MaterialPageRoute(
            builder: (BuildContext context) => ChildPage(title: '$title')));
      },
      child: Container(
        color: Colors.white,
        height: 54,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            // left
            Container(
              padding: const EdgeInsets.only(left: 15),
              child: Row(
                children: [
                  Image(
                    image: AssetImage(imageName!),
                    width: 25,
                  ),
                  const SizedBox(
                    width: 15,
                  ),
                  Text(title!)
                ],
              ),
            ),
            // right
            Container(
              padding: const EdgeInsets.all(10),
              child: Row(
                children: [
                  subtitle != null ? Text(subtitle!) : const Text(''),
                  subImageName != null
                      ? Image(
                          image: AssetImage(subImageName!),
                          width: 15,
                        )
                      : Container(),
                  const Image(
                    image: AssetImage('images/icon_right.png'),
                    width: 14,
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
